
using System;
using System.Text;

using NHibernate;
using NHibernate.Cfg;
using NHibernate.Criterion;
using NHibernate.Exceptions;

using SpotifyGenNHibernate.EN.Spotify;
using SpotifyGenNHibernate.CAD.Spotify;

namespace SpotifyGenNHibernate.CEN.Spotify
{
    public partial class TPVCEN
    {
        public bool ComprobarCapital (int p_oid, string cuenta, string cod, double precio)// se comprueba si tiene dinero en la cuenta, operacion tonta, 
                                                                                          //se hace un random con 75% de que salgo ok y 25% de que no
        {
            /*PROTECTED REGION ID(Spotify.TPVCEN_ComprobarCapital_precondition) START*/

            // Preconditions
            // if( !() )
            //              throw new ModelException("Method ComprobarCapital() preconditions are violated.");

            /*PROTECTED REGION END*/

            /*PROTECTED REGION ID(Spotify.TPVCEN_ComprobarCapital_body) ENABLED START*/

            // Body
            Random ok = new Random();
            if (ok.Next(4) == 3) 
            {
                return false;
            }
            else
            {
                return true;
            }
            /*PROTECTED REGION END*/

            /*PROTECTED REGION ID(Spotify.TPVCEN_ComprobarCapital_postcondition) START*/

            // Postconditions
            // if( !() )
            //              throw new ModelException("Method ComprobarCapital() postconditions are violated.");

            /*PROTECTED REGION END*/
        }
    }
}
